//
//  Contact.m
//  通讯录
//
//  Created by 李世友 on 16/4/28.
//  Copyright © 2016年 李世友. All rights reserved.
//

#import "Contact.h"

@implementation Contact
+(instancetype)initWithName:(NSString *)name num:(NSString *)num
{
    Contact *con = [[Contact alloc]init];
    con.name = name;
    con.num = num;
    con.groupName = [[name substringToIndex:1] uppercaseString];//分组名就不用作为参数,直接在方法中创建出来了
    return con;//有-(instancetype)才有 return [Contact alloc]initWithName:(NSString *)name num:(NSString *)num groupName:(NSString *)groupName 在主函数中要按照便利构造器的形式来创建对象

   
}
-(void)info
{
    NSLog(@"name:%@,num:%@,groupName:%@",_name,_num,_groupName);
}
@end
